/**
 * API 配置文件
 */

// 后端 API 基础地址
export const API_BASE_URL ='http://154.219.117.72:8000'

// API 端点
export const API_ENDPOINTS = {
  // OKX 交易所相关接口
  OKX: {
    TICKERS: '/api/okx/tickers',
    TICKER: (instId) => `/api/okx/ticker/${instId}`,
    ORDERBOOK: (instId) => `/api/okx/orderbook/${instId}`,
    CANDLES: (instId) => `/api/okx/candles/${instId}`,
    INSTRUMENTS: '/api/okx/instruments',
    EXCHANGE_RATE: '/api/okx/exchange-rate',
    BALANCE: '/api/okx/balance',
    POSITIONS: '/api/okx/positions',
    ORDER: '/api/okx/order',
    CANCEL_ORDER: (instId, ordId) => `/api/okx/order/${instId}/${ordId}`,
    GET_ORDER: (instId, ordId) => `/api/okx/order/${instId}/${ordId}`
  },
  
  // 用户管理接口
  USERS: {
    LIST: '/api/users',
    CREATE: '/api/users',
    GET: (userId) => `/api/users/${userId}`,
    UPDATE: (userId) => `/api/users/${userId}`,
    DELETE: (userId) => `/api/users/${userId}`
  },
  
  // 商品管理接口
  PRODUCTS: {
    LIST: '/api/products',
    CREATE: '/api/products',
    GET: (productId) => `/api/products/${productId}`,
    DELETE: (productId) => `/api/products/${productId}`
  }
}

// 请求超时时间（毫秒）
export const REQUEST_TIMEOUT = 30000  // 30秒，用于支持回测等耗时操作

// 重试配置
export const RETRY_CONFIG = {
  maxRetries: 3,
  retryDelay: 1000
}
